<?php
/**
 * Created by JetBrains PhpStorm.
 * User: GMC
 * Date: 10/3/13
 * Time: 2:20 PM
 * To change this template use File | Settings | File Templates.
 */

class WidgetUpProduct extends CWidget {
    public $categories, $name, $cat_id;

    public function init() {
        $this->categories = Category::model()->findAll(array(
            'select' => 'cat_id, cat_name',
            'condition' => 'parent_id > 0',
        ));

//        $session = Yii::app()->session['up_product'];
//        if ($session != null) {
//            $this->name = isset($session['name']) ? $session['name'] : '';
//            $this->cat_id = isset($session['name']) ? $session['name'] : '';
//            unset(Yii::app()->session['up_product']);
//        }
    }

    public function run() {
        return CWidget::render('widgetUpProduct', array('categories' => $this->categories, 'name' => $this->name, 'cat_id' => $this->cat_id));
    }
}